<?php

class Damages_Methods_Data_Attachments_New extends Damages_Methods_Data_Attachments {

  public function __construct($obj) {
    if ($obj->waybill)
      $this->waybill = new Damages_Methods_Data_Attachment_Simple ($obj->waybill);
    if ($obj->protocol)
      $this->protocol = new Damages_Methods_Data_Attachment_Simple ($obj->protocol);
    if ($obj->photos){
      foreach ($obj->photos->toArray() as $photo){
        $this->photos[] = new Damages_Methods_Data_Attachment_Simple ($photo);
      }
    }
    if ($obj->additional){
      foreach ($obj->additional->toArray() as $additional){
        $this->additional[] = new Damages_Methods_Data_Attachment_Simple ($additional);
      }
    }
  }

}